import { request } from "@/api/service";
import { BUTTON_STATUS_NUMBER } from "@/config/button";
import { urlPrefix as complaintsPrefix } from "./api";


export const crudOptions = vm => {
  return {
    pageOptions: {
      compact: true,
      export: {
        local: true,//本地导出，false为服务端导出
      },
    },
    options: {
      tableType: "vxe-table",
      rowKey: true, // 必须设置，true or false
      rowId: "id",
      height: "100%", // 表格高度100%, 使用toolbar必须设置
      highlightCurrentRow: false
    },
    rowHandle: {
      width: 140,
      view: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Retrieve");
        }
      },
      edit: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Update");
        }
      },
      remove: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Delete");
        }
      }
    },
    indexRow: {
      // 或者直接传true,不显示title，不居中
      title: "序号",
      align: "center",
      width: 100
    },
    viewOptions: {
      componentType: "form"
    },
    formOptions: {
      defaultSpan: 24, // 默认的表单 span
      width: "35%"
    },
    columns: [{
      title: "ID",
      key: "id",
      show: false,
      disabled: true,
      width: 90,
      form: {
        disabled: true
      }
    },

    {
      title: "月份",
      key: "月份",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "月份必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入月份"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "辖区",
      key: "所在区",
      width: 100,
      sortable: true,

      search: {
        disabled: false,
        component: {
          props: {
            clearable: true
          }
        }
      },

      type: "select",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "辖区必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入辖区"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      },
      dict: {  //本地数据字典
        data: [
          { value: '思明区', label: '思明区' },
          { value: '湖里区', label: '湖里区' },
          { value: '集美区', label: '集美区' },
          { value: '翔安区', label: '翔安区' },
          { value: '海沧区', label: '海沧区' },
          { value: '同安区', label: '同安区' }
        ]
      }
    },
    {
      title: "产品类别",
      key: "产品类别",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "产品类别必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入产品类别"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "产品种类",
      key: "产品种类",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "产品种类必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入产品种类"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "产品品种",
      key: "产品品种",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "产品品种必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入产品品种"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "国民经济分类",
      key: "国民经济分类",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "国民经济分类必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入国民经济分类"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "任务类别",
      key: "任务类别",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "任务类别必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入任务类别"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "报告单编号",
      key: "报告单编号",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "报告单编号必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入报告单编号"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "企业名称",
      key: "企业名称",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "企业名称必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入企业名称"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "产品名称",
      key: "产品名称",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "产品名称必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入产品名称"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "规格",
      key: "规格",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "规格必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入规格"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "结论",
      key: "结论",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "结论必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入结论"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "不合格项目",
      key: "不合格项目",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "不合格项目必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入不合格项目"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "商标",
      key: "商标",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "商标必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入商标"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "抽样日期",
      key: "抽样日期",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "datetime",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "抽样日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入抽样日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "生产日期",
      key: "生产日期",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "生产日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入生产日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "企业规模",
      key: "企业规模",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "企业规模必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入企业规模"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "受检产品上年度销售额",
      key: "受检产品上年度销售额",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "受检产品上年度销售额必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入受检产品上年度销售额"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "经济类型",
      key: "经济类型",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "经济类型必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入经济类型"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "生产许可证号及有效期",
      key: "生产许可证号及有效期",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "生产许可证号及有效期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入生产许可证号及有效期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "联系人",
      key: "联系人",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "联系人必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入联系人"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "电话",
      key: "电话",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "电话必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入电话"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "邮政编码",
      key: "邮政编码",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "邮政编码必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入邮政编码"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "通讯地址",
      key: "通讯地址",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "通讯地址必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入通讯地址"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "企业代码",
      key: "企业代码",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "企业代码必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入企业代码"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "受检企业名称",
      key: "受检企业名称",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "受检企业名称必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入受检企业名称"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "生产企业名称",
      key: "生产企业名称",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "生产企业名称必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入生产企业名称"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "生产单位",
      key: "生产单位",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "生产单位必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入生产单位"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "批号_生产日期",
      key: "批号_生产日期",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "批号_生产日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入批号_生产日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "抽样领域",
      key: "抽样领域",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "抽样领域必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入抽样领域"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "受检企业联系人",
      key: "受检企业联系人",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "受检企业联系人必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入受检企业联系人"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "受检企业电话",
      key: "受检企业电话",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "受检企业电话必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入受检企业电话"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "受检企业邮政编码",
      key: "受检企业邮政编码",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "受检企业邮政编码必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入受检企业邮政编码"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "受检企业通讯地址",
      key: "受检企业通讯地址",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "受检企业通讯地址必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入受检企业通讯地址"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "生产企业地址",
      key: "生产企业地址",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "生产企业地址必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入生产企业地址"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "生产单位联系电话",
      key: "生产单位联系电话",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "生产单位联系电话必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入生产单位联系电话"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "何时寄区局",
      key: "何时寄区局",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "何时寄区局必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入何时寄区局"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "生产单位联系人",
      key: "生产单位联系人",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "生产单位联系人必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入生产单位联系人"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "备注",
      key: "备注",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "备注必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入备注"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    ].concat(vm.commonEndColumns())
  };
};
